#define _TEST_TASK_MODULE_

#include "pulse.h"
#include "dataproc.h"
#include "pulse.h"
#include "osObjects.h"
#include "pincfg.h"
#include "com_hal.h" 
#include "at24c.h" 

extern  uint32_t uwTick;
timer_pulse_type tmp;
char snd_buff[64];
uint8_t at24_buff[4096];

void eep_iic_init(void);

/*****************************************************************************/ /*!
*
* @brief   led task.
*
* @param   none
*
* @return  none
*
* @ Pass/ Fail criteria: none
*****************************************************************************/
void TestTask(void *argument)
{
  uint32_t cnt;
  
    osDelay(500);

    eep_iic_init();
    
    at24_read(0, 2048, at24_buff);
    if(0xFF == at24_buff[0])
    {
        cnt = 1024;
        while(cnt--)
        {
          at24_buff[2*cnt] = cnt * 3;
          at24_buff[2*cnt+1] = (cnt * 3)>>8;
        }
        
        at24_write(0,1024,at24_buff);
    }
      
    for (;;)
    {
        osDelay(ms_ticks(20));
        
        PulseCreat(&tmp, uwTick);
        /* USER CODE END WHILE */
        if(tmp.bPulse_1s)
        {
            TimeRun();
            TimeToAscii(&TimeCur,(uint8_t *)snd_buff);
            ComDataSend(sprintf((char*)(com_obj.tBuff),"time %s \r\n",snd_buff));    
        }
        
        if(tmp.bPulse_100ms)
        {
            LED = !LED;    
        }
    }
}
